//权限检查指令
import { DirectiveBinding } from 'vue';

export default {
    mounted(el: HTMLElement, binding: DirectiveBinding) {
        const { value } = binding;
        const permissions = (window as any).permissions || []; // 假设权限存储在全局变量中

        if (value && Array.isArray(value) && value.length > 0) {
            const hasPermission = value.every(permission => {
                return permissions.includes(permission);
            });

            if (!hasPermission) {
                el.parentNode?.removeChild(el); // 或者使用其他方式隐藏元素
            }
        }
    }
};